import math


class Point:
    x = 0.0
    y = 0.0

    def __init__(self, x=0.0, y=0.0):
        self.x = x
        self.y = y

    def __add__(self, p):
        if type(p) is Point:
            return Point(self.x + p.x, self.y + p.y)
        else:
            return Point(self.x + p, self.y + p)

    def __sub__(self, p):
        if type(p) is Point:
            return Point(self.x - p.x, self.y - p.y)
        else:
            return Point(self.x - p, self.y - p)

    def __iadd__(self, p):
        if type(p) is Point:
            return Point(self.x + p.x, self.y + p.y)
        else:
            return Point(self.x + p, self.y + p)

    def __isub__(self, p):
        if type(p) is Point:
            return Point(self.x - p.x, self.y - p.y)
        else:
            return Point(self.x - p, self.y - p)

    def __idiv__(self, p):
        return Point(self.x / p, self.y / p)

    def __imul__(self, p):
        return Point(self.x * p, self.y * p)

    def __mul__(self, p):
        return Point(self.x * p, self.y * p)

    def __div__(self, p):
        return Point(self.x / p, self.y / p)

    def __truediv__(self, p):
        return Point(self.x / p, self.y / p)

    def __floordiv__(self, p):
        return Point(self.x // p, self.y // p)

    def __str__(self):
        return "(%s, %s)" % (self.x, self.y)

    def __repr__(self):
        return "%s(%r, %r)" % (self.__class__.__name__, self.x, self.y)

    def length(self):
        return math.hypot(self.x, self.y)

    def distance_to(self, p):
        """Calculate the distance between two points."""
        return (self - p).length()

    def clone(self):
        """Return a full copy of this point."""
        return Point(self.x, self.y)

    def to_int(self):
        """Convert co-ordinate values to integers."""
        return Point(int(self.x), int(self.y))

    def to_float(self):
        return Point(float(self.x), float(self.y))

    def translate(self, v1, v2=None):
        if type(v1) is Point:
            self.x += v1.x
            self.y += v1.y
        elif v2 is not None:
            self.x += v1
            self.y += v2

    def rotate(self, degree, v1=None, v2=None):
        cx = 0
        cy = 0
        if v1 is not None:
            if type(v1) is Point:
                cx = v1.x
                cy = v1.y
            elif v2 is not None:
                cx = v1
                cy = v2
        x, y = self.x - cx, self.y - cy
        s, c = [f(math.radians(degree)) for f in (math.sin, math.cos)]
        rx, ry = (c * x - s * y, s * x + c * y)
        return Point(rx + cx, ry + cy)

